package com.liuxing.doctor.mapper;

import com.liuxing.doctor.entity.Prescription;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;
import java.util.Map;

@Mapper
public interface PrescriptionMapper {
    int deleteByPrimaryKey(Integer prescriptionId);

    int insert(Prescription record);

    int insertSelective(Prescription record);

    Prescription selectByPrimaryKey(Integer prescriptionId);

    int updateByPrimaryKeySelective(Prescription record);

    int updateByPrimaryKey(Prescription record);

    /**
     * 查询病人处方
     * @param patient_id
     * @return  处方的集合
     */
    List<Prescription> selectPrescriptionsByPatientId(String patient_id);

    /**
     * 给病人插入一条空的处方记录
     * @param map
     * @return
     */
    int insertNullPrescriptionByPatientId(Map<String,Object> map);

    /**
     * 删除病人处方
     * @param patient_id
     * @return  影响记录条数
     */
    int deletePrescriptionsByPatientId(String patient_id);

    /**
     * 更新保存病人最新的处方
     * @param map
     * @return
     */
    int updatePatientPrescription(Map<String,Object> map);

    /**
     * 给病人插入一条处方记录
     * @param map
     * @return
     */
    int insertPrescriptionByPatient(Map<String,Object> map);

    int insertPrescription(Prescription prescription);
}